<?php require_once 'head.html';?>
        <div class="span9">
		  <div class="row-fluid">
			<div class="page-header">
				<h1>链接列表 <small> Links List</small></h1>
			</div>
			<?php if(count($Query)){?>
			<table class="table table-striped table-bordered table-condensed">
				<thead>
					<tr>
						<th>序号</th>
						<th>链接</th>
						<th>状态</th>
						<th>查看</th>
						<th>描述</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>

				<?php $i=1;foreach ($Query as $link){?>
				<tr class="list-roles">
					<td><?php echo $i;?></td>
					<td><a href="?c=link&ip=edit&id=<?php echo $link['id'];?>"><?php echo $link['link_title'];?></a></td>
					<td><?php if($link['link_res']){?><a href="?c=link&ip=hidden&res=0&id=<?php echo $link['id'];?>">显示</a><?php }else{?><a href="?c=link&ip=hidden&res=1&id=<?php echo $link['id'];?>">隐藏</a><?php }?></td>
					<td><a href="<?php echo $link['link_url'];?>" target="_blank">查看</a></td>
					<td><?php echo $link['link_content'];?></td>
					<td>
						<div class="btn-group">
							<a class="btn btn-mini dropdown-toggle" data-toggle="dropdown" href="#">操作 <span class="caret"></span></a>
							<ul class="dropdown-menu pull-right">
								<li><a href="?c=link&ip=edit&id=<?php echo $link['id'];?>"><i class="icon-pencil"></i> 编辑</a></li>
								
								<li><a onclick='if (confirm("确定删除？") == true){location.href="?c=link&ip=del&id=<?php echo $link['id'];?>";}'><i class="icon-trash"></i> 删除</a></li>
							</ul>
						</div>
					</td>
				</tr>
				<?php $i++;}?>
				
				</tbody>
			</table>
			<div class="pagination">
				<ul>
					<?php if($p !== 1){?><li><a href="?c=link&p=<?php echo $break;?>">上页</a></li><?php }?>
		             <?php LinkPage($pageCount, $p, 6);?>
					<?php if($p !== $pageCount){?><li><a href="?c=link&p=<?php echo $next;?>">下页</a></li><?php }?>
				</ul>
			</div>
			<?php }else{?>
			<p>没有任何链接，快速添加一个吧！</p>
			<?php }?>
			<?php if(empty($_GET['ip'])){?>
			<form class="form-horizontal" action="?c=link" method="post">
				<fieldset>
					<div class="control-group">
						<label class="control-label" for="link_title">*名称</label>
						<div class="controls">
							<input name="link_title" type="text" class="input-xlarge" id="link_title" placeholder="请输入网站名称.."/>
						</div>
					</div>
					<div class="control-group">
						<label class="control-label" for="link_url">*地址</label>
						<div class="controls">
							<input name="link_url" type="text" class="input-xlarge" id="link_url" placeholder="请输入网站地址.."/>
						</div>
					</div>
					
					<div class="control-group">
						<label class="control-label" for="link_content">描述</label>
						<div class="controls">
							<textarea name="link_content" class="input-xlarge" id="link_content" placeholder="请输入网站描述.."/></textarea>
						</div>
					</div>
				
					<div class="form-actions">
						<input name="add_link" type="submit" class="btn btn-success btn-large" value="添加链接" /> <a class="btn" href="?c=index">返回仪表盘</a>
					</div>					
				</fieldset>
			</form>
			<?php }else{?>
			<form class="form-horizontal" action="" method="post">
				<fieldset>
					<div class="control-group">
						<label class="control-label" for="link_title">*名称</label>
						<div class="controls">
							<input name="link_title" type="text" class="input-xlarge" id="link_title" placeholder="请输入网站名称.." value="<?php echo $LinkNum['link_title'];?>"/>
						</div>
					</div>
					<div class="control-group">
						<label class="control-label" for="link_url">*地址</label>
						<div class="controls">
							<input name="link_url" type="text" class="input-xlarge" id="link_url" placeholder="请输入网站地址.." value="<?php echo $LinkNum['link_url'];?>"/>
						</div>
					</div>
					
					<div class="control-group">
						<label class="control-label" for="link_content">描述</label>
						<div class="controls">
							<textarea name="link_content" class="input-xlarge" id="link_content" placeholder="请输入网站描述.."/><?php echo $LinkNum['link_content'];?></textarea>
						</div>
					</div>
				
					<div class="form-actions">
						<input name="edit_link" type="submit" class="btn btn-success btn-large" value="修改链接" /> <a class="btn" href="?c=index">返回仪表盘</a>
					</div>					
				</fieldset>
			</form>
			
			
			
			<?php }?>
		  </div>
        </div>
      </div>

      <hr>

       <?php require_once 'foot.html';?>

    </div>

      <script src="Delivery/js/jquery.js"></script>
	<script src="Delivery/js/bootstrap.min.js"></script>
	<script>
	$(document).ready(function() {
		$('.dropdown-menu li a').hover(
		function() {
			$(this).children('i').addClass('icon-white');
		},
		function() {
			$(this).children('i').removeClass('icon-white');
		});
	});
	</script>
  </body>
</html>
